package cn.qayy.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import cn.qayy.dao.CargoInvoiceApplyMapper;
import cn.qayy.dto.CargoInvoiceApplyDTO;
import cn.qayy.po.CargoInvoiceApply;
import cn.qayy.service.ICargoService;
import cn.qayy.utils.DownLoadUtil;
@Service("cargoInvoiceApplyImpl")
@SuppressWarnings("all")
public class CargoInvoiceApplyImpl implements ICargoService {
	private Logger logger = LoggerFactory.getLogger(CargoInvoiceApplyImpl.class);

	@Resource
	public CargoInvoiceApplyMapper cargoInvoiceApplyMapper;
	
	@Override
	public PageInfo<CargoInvoiceApply> selectForList(CargoInvoiceApplyDTO dto) throws Exception{
		if (dto != null) {
			DownLoadUtil.set("CargoInvoiceApplyDTO",dto);
			PageHelper.startPage(dto.getPageNumber(), dto.getPageSize());
			List<CargoInvoiceApply> list = cargoInvoiceApplyMapper.selectForList(dto);
			PageInfo<CargoInvoiceApply> pageInfo = new PageInfo<CargoInvoiceApply>(list);
			return pageInfo;
		}
		return null;
	}

	@Override
	public List<Map<String, Object>> selectForDown(CargoInvoiceApplyDTO dto) throws Exception {
		List<Map<String, Object>> list = cargoInvoiceApplyMapper.selectForDown(dto);
		return list;
	}

	@Override
	public CargoInvoiceApply selectByID(@RequestParam Long id) throws Exception {
		return cargoInvoiceApplyMapper.selectByPrimaryKey(id);
	}

	@Override
	public int updateByList(List list) throws Exception{
		return cargoInvoiceApplyMapper.updateByList(list);
	}

	@Override
	public int deleteByList(List list) throws Exception{
		return cargoInvoiceApplyMapper.deleteByList(list);
	}

	@Override
	public int insert(Object bean) throws Exception{
		return cargoInvoiceApplyMapper.insert(bean);
	}

	@Override
	public int update(Object bean) throws Exception{
		return cargoInvoiceApplyMapper.updateByPrimaryKey(bean);
	}

	@Override
	public int delete(Object bean) throws Exception{
		return cargoInvoiceApplyMapper.delete(bean);
	}

	@Override
	public int insertByList(List list) throws Exception{
		return cargoInvoiceApplyMapper.insertByList(list);
	}

	@Override
	public CargoInvoiceApply selectLastOneByMap(Map<String, Object> params) throws Exception {
		return cargoInvoiceApplyMapper.selectLastOneByMap(params);
	}
	@Override
	public List<CargoInvoiceApply> checkRssociation(Map<String, Object> params){
		return cargoInvoiceApplyMapper.checkRssociation(params);
	}

	@Override
	public int deleteByPrimaryKey(long id) {
		return cargoInvoiceApplyMapper.deleteByPrimaryKey(id);
	}

}
